Skip to content

Use Utils\make_temp_file() / Utils\make_temp_dir() for package ZIP install temp paths - #250

Draft
schlessera with Copilot wants to merge 6 commits into
mainfrom
copilot/use-utils-make-temp-file-dir
Draft

Use Utils\make_temp_file() / Utils\make_temp_dir() for package ZIP install temp paths#250
schlessera with Copilot wants to merge 6 commits into
mainfrom
copilot/use-utils-make-temp-file-dir

Conversation

Copilot AI commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Package_Command::install() still built temporary ZIP and extraction paths manually with get_temp_dir() + uniqid(), despite WP-CLI now providing dedicated temp helpers. This PR migrates those call sites and adds acceptance coverage for remote ZIP flows that exercise both download and extraction error/success paths.

  • Temp path helper migration

    • Replaced manual temp ZIP filename generation with Utils\make_temp_file( 'wp-cli-package_', '.zip' ).
    • Replaced manual temp extraction directory path generation with Utils\make_temp_dir( 'wp-cli-package_' ).
    • Keeps existing install flow intact while relying on core temp-path semantics (pre-created temp dir, normalized path handling).
  • Remote ZIP acceptance coverage

    • Added scenario for successful remote ZIP install via locally served ZIP fixture.
    • Added scenario for successful install from alternate ZIP layout (files at archive root).
    • Added failure scenarios for invalid ZIP contents and HTTP 404 download response.
  • Illustrative change

// Before
$temp = Utils\get_temp_dir() . uniqid( 'wp-cli-package_', true ) . '.zip';
$dir_package = Utils\get_temp_dir() . uniqid( 'wp-cli-package_', true );

// After
$temp = Utils\make_temp_file( 'wp-cli-package_', '.zip' );
$dir_package = Utils\make_temp_dir( 'wp-cli-package_' );

@coderabbitai

coderabbitai Bot commented Sep 11, 2026

Copy link
Copy Markdown

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 2f617328-b34c-45e1-871e-2056c110bf68

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI and others added 5 commits September 11, 2026 21:57
Co-authored-by: schlessera <83631+schlessera@users.noreply.github.com>
Co-authored-by: schlessera <83631+schlessera@users.noreply.github.com>
Co-authored-by: schlessera <83631+schlessera@users.noreply.github.com>
Co-authored-by: schlessera <83631+schlessera@users.noreply.github.com>
Co-authored-by: schlessera <83631+schlessera@users.noreply.github.com>
Copilot AI changed the title [WIP] Refactor Package_Command to use Utils emp functions Use Utils\make_temp_file() / Utils\make_temp_dir() for package ZIP install temp paths Sep 11, 2026
Copilot AI requested a review from schlessera September 11, 2026 22:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use Utils\make_temp_file() and Utils\make_temp_dir() for temporary paths

2 participants